using System;
using System.Collections.Generic;
using System.Text;
using NHibernate;
using NHibernate.Mapping.Attributes;
using Lib;

namespace Persistance.Model
{


    ///<summary>
    /// User Object Specification
    ///
    /// UserID (int) --> The unique ID associated with this user.
    /// FullName (varchar) --> The Fullname of the user. Decided to store this for convenience sake.
    /// SecurityLevel (int) --> A number between 1 and 30 to denote the users security clearance. Left a lot of room in case different user types are added in the future.
    ///</summary>

    [Serializable]
    [Class(Lazy = true)]
    public class Photos
    {
        #region " Mapping "

        /// <summary>
        /// This is needed for NH. NH only accepts numeric primary keys
        /// </summary>
        private int _photoID;
        //NHIBER: Setts the primary key to ID
        [Id(Name = "PhotoID")]
        [Generator(1, Class = "native")]
        public virtual int PhotoID
        {
            get { return _photoID; }
            set { _photoID = value; }
        }

        /// <summary>
        /// The fullname of the user.
        /// </summary>
        //private int _itemID;
        //[Property(Type = "int")]
        //public virtual int ItemID
        //{
        //    get { return _itemID; }
        //    set { _itemID = value; }
        //}

        private byte[] _bytesFull;
        [Property(Type = "Byte[]")]
        public virtual byte[] BytesFull
        {
            get { return _bytesFull; }
            set { _bytesFull = value; }
        }

        private byte[] _bytesSmall;
        [Property(Type = "Byte[]")]
        public virtual byte[] BytesSmall
        {
            get { return _bytesSmall; }
            set { _bytesSmall = value; }
        }

        private byte[] _bytesMedium;
        [Property(Type = "Byte[]")]
        public virtual byte[] BytesMedium
        {
            get { return _bytesMedium; }
            set { _bytesMedium = value; }
        }

        private Int16 _isMainView;
        [Property(Type = "Boolean")]
        public virtual Int16 IsMainView
        {
            get { return _isMainView ; }
            set { _isMainView  = value; }
        }

        private DateTime _dateCreated;
        //[Property(Type = DateTime)]
        public virtual DateTime DateCreated
        {
            get { return _dateCreated; }
            set { _dateCreated = value; }
        }

        #endregion

        ///<summary>
        ///Holds the item of each photo
        ///</summary>
        private Items _item;
        [ManyToOne(Column = "ItemID", Cascade = CascadeStyle.All, ForeignKey = "PhotoToItemType")]
        public virtual Items Item
        {
            get { return _item; }
            set { _item = value; }
        }

    }
    


}
